@echo off
set serviceName=HWTimeRecorder
for /f "tokens=1,2 delims==" %%i in ('set LoginRecorderInstallDir') do set InstallDir=%%j

sc query %serviceName% > nul
if %errorlevel% equ 0 (
	net stop %serviceName%
	sc delete %serviceName% > nul	
)

sc create %serviceName% binPath= %InstallDir%\%serviceName%.exe start=auto

if %errorlevel% equ 0 (
	net start %serviceName%
) else (
	echo 创建失败
)